package nine;

import java.util.Random;
import java.util.Scanner;

public class Cai {
    public static void main(String[] args) {
        Random ra = new Random();
        int a = ra.nextInt(100) + 1;
        Scanner sc = new Scanner(System.in);
        panduan(a);
    }

    static void panduan(int a) {
        int count = 0;
        System.out.println("游戏开始，请猜一个1-100之间的数字");
        Scanner sc = new Scanner(System.in);
        for (; ; ) {
            int n = sc.nextInt();
            System.out.println("输入你猜的数字" + n);
            if (a < n) {
                System.out.println(n + "不对，有点太大了");
                count++;
            } else if (a > n) {
                System.out.println(n + "不对，有点太小了");
                count++;
            } else {
                count++;
                System.out.println("猜对了！答案就是" + n + "，您一共猜了" + count + "次，送您称号『" + panduan1(count) + "』！");
            }
        }

    }
    static String panduan1(int count) {
        String name = "";
        if (count <= 5 && count > 1) {
            name = "登峰造极";
        } else if (count >= 6 && count <= 8) {
            name = "炉火纯青";
        } else if (count >= 9 && count <= 10) {
            name = "略有小成";
        } else {
            name = "初出茅庐";
        }
        return name;
    }
}
